const compressionPlugin = require('compression-webpack-plugin')

module.exports = {
    css: {
        requireModuleExtension: true
    },
    devServer: {
        port: 8889
    },
    chainWebpack: config => {
        config
            .plugin('html')
            .tap(args => {
                args[0].title = '懒得记账'
                return args
            })
    },
    pwa: {
        iconPaths: {
            favicon32: 'favicon.ico',
            favicon16: 'favicon.ico',
            appleTouchIcon: 'favicon.ico',
            maskIcon: 'favicon.ico',
            msTileImage: 'favicon.ico'
        }
    },
    // eslint-disable-next-line no-unused-vars
    configureWebpack: config => {
        return {
            plugins: [
                new compressionPlugin({
                    algorithm: 'gzip',
                    test: /\.js$|\.html$|\.css/,
                    threshold: 10240,
                    deleteOriginalAssets: false
                })
            ],
            externals:{//排除一些引入的模块，不进行打包
                'vue':'Vue',
                'axios':'axios',
                'vue-router': 'VueRouter',
                'echarts': 'echarts'
            }
        }
    }
}
